{include file="public/header" /}
<style>
    .layui-table-cell{
        padding: 1px;
    }
</style>
<body class="gray-bg">
<div class="wrapper wrapper-content">
    <div class="ibox float-e-margins">
        <div class="ibox-content">
            <div class="row">
                <!--搜索框开始-->
                <div class="col-sm-12">
                    <div class="layui-form layui-form-item">
                        <div class="layui-col-md6 layui-input-inline">
                            <input type="text" style="width: 300px;" id="n_title" class="layui-input search" name="n_title" placeholder="订单号/收件人姓名/收件人手机号/快递单号"/>
                        </div>
                        <div class="layui-col-md6 layui-input-inline">
                            <input type="text" style="width: 90px;margin-left: 110px;" id="orderid" class="layui-input search" name="orderid" placeholder="订单id"/>
                        </div>
                        <div class="layui-input-inline" style="border: 1px solid mediumseagreen;margin-left: 10px;">
                            <input type="text"  name="start" onclick="wk.lay_date(this);" readonly class="layui-input layer-date search" placeholder="申请退款时间-起" />
                        </div>
                        <div class="layui-input-inline" style="border: 1px solid mediumseagreen">
                            <input type="text"  name="end" onclick="wk.lay_date(this);" readonly class="layui-input layer-date search" placeholder="申请退款时间-止" />
                        </div>
                        <div class="layui-input-inline">
                            <button class="layui-btn" lay-submit="" lay-filter="LAY-search">立即搜索</button>
                            <button class="layui-btn layui-btn-normal" id="empty" lay-submit="" lay-filter="LAY-search">
                                重置
                            </button>
                        </div>
                    </div>
                </div>
                <!--搜索框结束-->
                <!--操作框开始-->
                <!--<div class="col-sm-12">-->
                    <!--<div class="input-group" >-->
                        <!--<button  class="btn btn-danger m-l-xs" href="javascript:;" data-toggle="dropdown">-->
                            <!--<i class="fa fa-wrench"></i> 导出 <span class="caret"></span>-->
                        <!--</button>-->
                        <!--<ul class="dropdown-menu layui-anim layui-anim-upbit" role="menu">-->
                            <!--<li><a  href="javascript:;" class="layuiBtn" data-type="excelAll"><i class="fa fa-print"></i> 导出汇总</a></li>-->
                            <!--<li><a  href="javascript:;" class="layuiBtn" data-type="excelAllDetail"><i class="fa fa-print"></i> 导出明细</a></li>-->
                        <!--</ul>-->
                    <!--</div>-->
                <!--</div>-->
                <!--操作框结束-->
            </div>
            <div class="hr-line-dashed"></div>

            <div class="example-wrap">
                <div class="example">
                    <table class="layui-hide" id="test" lay-filter="testReload"></table>
                    <!--状态显示模板-->
                    <script type="text/html" id="pay_type">
                        {{# if(d.pay_type == 1){ }}
                        微信
                        {{# } }}
                        {{# if(d.pay_type == 2){ }}
                        支付宝
                        {{# } }}
                        {{# if(d.pay_type == 3){ }}
                        银联
                        {{# } }}

                    </script>
                    <!--操作模板-->
                    <script type="text/html" id="opeBar">
                        <a href="javascript:;" onclick="wk.layer_show('详情','{:url('orderInfo')}?order_id={{d.order_id}}')" class="btn btn-primary btn-xs m-r-xs" title="详情"><i class="fa fa-info">详情</i></a>
                        {{# if(d.admin_tui == 2){ }}
                        <a href="javascript:;" onclick="wk.confirm('{{d.order_id}}','{:url('orderTuiMoney')}','同意')" class="btn btn-primary btn-xs m-r-xs" title="同意"><i class="fa fa-check">同意</i></a>
                        <a href="javascript:;" onclick="wk.confirm('{{d.order_id}}','{:url('orderTuiMoneyNo')}','拒绝')" class="btn btn-danger btn-xs m-r-xs" title="拒绝"><i class="fa fa-trash-o">拒绝</i></a>
                        {{# } }}
                    </script>
                </div>
            </div>
        </div>
    </div>
</div>
<textarea id="allidsForOut" class="hidden"></textarea>
{include file="public/footer" /}
<script>
    //layui渲染数据表格
    layui.use('table', function () {
        var table = layui.table
            , form = layui.form;
        table.render({
            elem: '#test'
            , url: '{:url("Orderps/master")}'
            , response: {
                statusCode: 220 //成功的状态码，默认：0
            }
            , page: true
//            , size: 'lg' //sm小尺寸的表格 lg大尺寸
            , cellMinWidth: 150
            , limits: [5, 10, 15, 20, 25, 30]
            , limit: "{:config('pages')}"
            , loading: true
            , id: 'testReload'
            , cols: [[
                {type: 'checkbox', fixed: 'left',}
                , {type: 'numbers', width: 80, title: '序号'}
                , {field: 'order_no', width: '', title: '订单号', align: 'center'}
                , {field: 'order_back_order_id', width: '', title: '支付流水号', align: 'center'}
                , {field: 'all_good_nums', width: '80', title: '商品数量', align: 'center'}
                , {field: 'all_goods_price', width: '80', title: '商品金额', align: 'center'}
                , {field: 'express_original_price', width: '80', title: '运费', align: 'center'}
                , {field: 'total_price', width: '80', title: '实付款', align: 'center'}
                , {field: 'user_username', width: '80', title: '用户昵称', align: 'center'}
                , {field: 'name', width: '80', title: '收件人姓名', align: 'center'}
                , {field: 'pay_type', width: '80', title: '支付方式', align: 'center', toolbar: '#pay_type'}
                , {field: 'user_phone', width: '100', title: '用户手机号', align: 'center'}
                , {field: 'admin_tui_addtime', width: '', title: '申请退款时间', align: 'center'}
                , {field: 'admin_tui_money', width: '100', title: '退款申请金额', align: 'center'}
                , {fixed: 'right', width: 200, title: '操作', align: 'center', toolbar: '#opeBar'}
            ]]
            , done: function (res, curr, count) {
                $('.img-circle').viewer({
                    url: 'data-original',
                });
            }
        });
        //监听状态开关操作
        form.on('switch(OnOff)', function (obj) {
            var num = '';
            obj.elem.checked == true? num = 1: num = 2;
            //用户状态
            wk.status(this.value,num, '{:url("changeGoodStatus")}',obj);
        });
        //批量操作
        var $ = layui.$, active = {
            excelAll: function(){
                //导出Excel
                wk.excelAll('',$('.layui-input').serialize(),"{:url('excelOutOrder')}");
            },
            excelAllDetail: function(){
                //导出Excel
                wk.excelAll('',$('.layui-input').serialize(),"{:url('excelOutDetail')}");
            }
        };
        $('.layuiBtn').on('click', function () {
            var type = $(this).data('type');
            active[type] ? active[type].call(this) : '';
        });
        var getIds = function () {
            var ids = [];
            var checkStatus = table.checkStatus('testReload')
                , data = checkStatus.data;
            $.each(data, function (index, item) {
                ids.push(item['order_id'])
            });
            return ids;
        }
    });
</script>
</body>
</html>